-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deflate: Move advanced compression state #107
Conversation
Only allocate advanced compression state when actually needed. This will reduce upfront allocations for levels < 5 significantly.
# Conflicts: # compressible_test.go
Was this change reverted? These are the results I'm getting on master:
Much higher than those reported in this PR. I had similar results testing on my linux VM. |
@nhooyr This PR is about static allocations (allocations kept in the writer between writes/resets), though this seems rather high. Could you share the benchmark code? |
It's the same benchmark in this PR. Line 243 in 5e801bf
|
Ah, thanks :) |
Only allocate advanced compression state when actually needed.
This will reduce upfront allocations for levels < 5 significantly (reduced by approximately 750K)
Much less risk than #70 - but not as clean.
Of course this is only relevant when
Reset()
is not used.Benchmark: https://gist.github.com/klauspost/f5df3a3522ac4bcb3bcde448872dffe6
Before:
After: